package com.ljq.software_springboot.softwareprogram.mapper;

import com.ljq.software_springboot.softwareprogram.entity.ChatMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-12-29
 */
@Mapper
public interface ChatMemberMapper extends BaseMapper<ChatMember> {
    @Select("SELECT a.username FROM account a " +
            "JOIN group_member gm ON a.id = gm.user_id " +
            "WHERE gm.group_id = #{groupId}")
    List<ChatMember> getGroupMembers(@Param("groupId") Integer groupId);

}
